# main.py
from fastapi import FastAPI
# from markdown import router as markdown_router
from fastapi.middleware.cors import CORSMiddleware
from .markdown  import router as markdown_router
from .image     import router as image_router
from .banner    import router as banner_router

app = FastAPI()

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],  # 生产环境建议改成 ['https://你的前端域名.com']
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# 挂载 markdown 路由
app.include_router(markdown_router, prefix="/api/markdown")

app.include_router(image_router,    prefix="/api/image")

app.include_router(banner_router,   prefix="/api/banner")
